require "rake"  



desc "start server"
task :start do
  cmd = "rackup -s thin config.ru  -P tmp/rack.pid  -E production -p 9191 -D"
  system("#{cmd}")
end

desc "stop server"
task :stop do
  path = File.expand_path("..", __FILE__)
  file_path = File.join(path, "tmp/rack.pid")
  if File.exist?(file_path) then
    File.open(file_path) do |file|
      pid = file.read
      system("kill -9 #{pid}")
    end
    FileUtils.rm file_path
  end
end

desc "restart server"
task :restart => [:stop, :start]

task :default => :start
